package com.apexsoft.front.common.utils;

import java.util.Date;

public class MysqlClassUtil 
{
	public static ClassMapping[] classMapping = {
		//mysql
		new ClassMapping("INT",				new Class[]{int.class},			"getInt"),
		new ClassMapping("INT UNSIGNED",	new Class[]{int.class},			"getInt"),
		new ClassMapping("INTEGER",			new Class[]{int.class},			"getInt"),
		new ClassMapping("LONG",			new Class[]{float.class},		"getFloat"),
		new ClassMapping("CHAR",			new Class[]{String.class},		"getString"),
		new ClassMapping("VARCHAR",			new Class[]{String.class},		"getString"),
		new ClassMapping("TEXT",			new Class[]{String.class},		"getString"),
		new ClassMapping("DATE",			new Class[]{Date.class},		"getDate")
		
	};
	
	//获取映射关系
	public static ClassMapping getColumnClassMapping(String columnTypeName)
	{
		for(ClassMapping mapping:classMapping)
		{
			if(columnTypeName.equals(mapping.getTypeName()))
				return mapping;
		}
		return new ClassMapping("VARCHAR",new Class[]{String.class},"getString");
	}

}
